import pandas as pd

class ParkingDemandSupplyModel:
    def __init__(self, population_data, total_population):
        self.population_data = population_data
        self.total_population = total_population
    def calculate_demand(self):
        self.population_data['Demand'] = self.population_data['Population Census 2020-11-01']
    def calculate_supply(self, parking_spaces):
        self.population_data['Supply'] = parking_spaces
    def adjust_license_price(self, base_price, alpha):
        self.population_data['License Price'] = base_price * (1 + alpha * (self.population_data['Demand'] / self.population_data['Supply'] - 1))
    def calculate_population_ratio(self):
        self.population_data['Population Ratio'] = self.population_data['Population Census 2020-11-01'] / self.total_population

file_path = 'population_of_Beijing.xlsx'
df = pd.read_excel(file_path, engine='openpyxl')
total_population = df['Population Census 2020-11-01'].sum()
model = ParkingDemandSupplyModel(df, total_population)
model.calculate_demand()
parking_spaces = df['number']
model.calculate_supply(parking_spaces)
base_price = 100
alpha = 0.01
model.adjust_license_price(base_price, alpha)
model.calculate_population_ratio()
print(model.population_data[['Native', 'Population Ratio', 'Demand', 'Supply', 'License Price']])
output_file_path = 'population_ratio_results.xlsx'
model.population_data.to_excel(output_file_path, index=False, engine='openpyxl')